/*
 Navicat Premium Data Transfer

 Source Server         : 192.168.1.74-铁机开发环境
 Source Server Type    : MySQL
 Source Server Version : 80030
 Source Host           : 192.168.1.74:3306
 Source Schema         : gen

 Target Server Type    : MySQL
 Target Server Version : 80030
 File Encoding         : 65001

 Date: 21/02/2023 16:43:22
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for datasource_config
-- ----------------------------
DROP TABLE IF EXISTS `datasource_config`;
CREATE TABLE `datasource_config` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `db_type` int NOT NULL DEFAULT '0' COMMENT '数据库类型，1：MySql, 2:Oracle, 3:sqlserver',
  `driver_class` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT '' COMMENT '数据库驱动',
  `db_name` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '数据库名称',
  `host` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '数据库host',
  `port` int NOT NULL DEFAULT '0' COMMENT '数据库端口',
  `username` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '数据库用户名',
  `password` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '数据库密码',
  `is_deleted` int NOT NULL DEFAULT '0' COMMENT '是否已删除，1：已删除，0：未删除',
  `package_name` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
  `project_module` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '项目模块名',
  `del_prefix` varchar(200) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
  `group_id` int DEFAULT NULL,
  `schema_name` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
  `author` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
  `db_desc` varchar(64) DEFAULT NULL,
  `db_group_name` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC COMMENT='数据源配置表';

-- ----------------------------
-- Records of datasource_config
-- ----------------------------
BEGIN;
INSERT INTO `datasource_config` (`id`, `db_type`, `driver_class`, `db_name`, `host`, `port`, `username`, `password`, `is_deleted`, `package_name`, `project_module`, `del_prefix`, `group_id`, `schema_name`, `author`, `db_desc`, `db_group_name`) VALUES (1, 1, 'com.mysql.cj.jdbc.Driver', 'raven', '192.168.1.74', 3306, 'root', 'root', 0, 'cloud.epx.raven', NULL, 't_', 1, '', 'xuzhitu', 'raven', '基础服务');
INSERT INTO `datasource_config` (`id`, `db_type`, `driver_class`, `db_name`, `host`, `port`, `username`, `password`, `is_deleted`, `package_name`, `project_module`, `del_prefix`, `group_id`, `schema_name`, `author`, `db_desc`, `db_group_name`) VALUES (2, 1, 'com.mysql.cj.jdbc.Driver', 'raven_pas', '192.168.124.250', 3306, 'root', 'root', 0, 'cloud.epx.raven', 'pas', 't_', 2, '', 'xuzhitu', 'raven_pas', '心理评估数据库');
COMMIT;

-- ----------------------------
-- Table structure for generate_history
-- ----------------------------
DROP TABLE IF EXISTS `generate_history`;
CREATE TABLE `generate_history` (
  `id` int NOT NULL AUTO_INCREMENT,
  `config_content` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci,
  `md5_value` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
  `generate_time` datetime NOT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC;

-- ----------------------------
-- Records of generate_history
-- ----------------------------
BEGIN;
INSERT INTO `generate_history` (`id`, `config_content`, `md5_value`, `generate_time`) VALUES (1, '{\"author\":\"xuzhitu\",\"charset\":\"UTF-8\",\"datasourceConfigId\":1,\"delPrefix\":\"t_\",\"packageName\":\"cloud.epx.raven\",\"tableNames\":[\"sys_menu\"],\"templateConfigIdList\":[1,2,3,4,5]}', 'de1f547e19965adbb5109db166089ff3', '2023-02-15 16:18:25');
INSERT INTO `generate_history` (`id`, `config_content`, `md5_value`, `generate_time`) VALUES (2, '{\"author\":\"xuzhitu\",\"charset\":\"UTF-8\",\"datasourceConfigId\":1,\"delPrefix\":\"t_\",\"packageName\":\"cloud.epx.raven\",\"tableNames\":[\"sys_menu\",\"base_sequence\",\"flyway_schema_history\",\"sys_dept\",\"sys_dept_relation\",\"sys_dict\",\"sys_dict_item\",\"sys_file\",\"sys_highway_scope\",\"sys_highway_station\",\"sys_log\",\"sys_menu_app\",\"sys_menu_copy1\",\"sys_menu_workbench\",\"sys_oauth_client_details\",\"sys_public_param\",\"sys_role\",\"sys_role_menu\",\"sys_role_menu_app\",\"sys_role_menu_app_index\",\"sys_role_menu_workbench\",\"sys_route_conf\",\"sys_social_details\",\"sys_tenant\",\"sys_unit\",\"sys_unit_attach\",\"sys_unit_relation\",\"sys_user\",\"sys_user_function_menu\",\"sys_user_role\",\"sys_workbench_config\"],\"templateConfigIdList\":[1,2,3,4,5]}', 'f6a444ffd74e335e3e1143b6be6bf6db', '2023-02-15 16:24:33');
INSERT INTO `generate_history` (`id`, `config_content`, `md5_value`, `generate_time`) VALUES (3, '{\"author\":\"xuzhitu\",\"charset\":\"UTF-8\",\"datasourceConfigId\":1,\"delPrefix\":\"t_\",\"packageName\":\"cloud.epx.raven\",\"tableNames\":[\"sys_dict\"],\"templateConfigIdList\":[5]}', '1d7e5d12a145d5c561f626553d1e4cf9', '2023-02-15 16:26:28');
INSERT INTO `generate_history` (`id`, `config_content`, `md5_value`, `generate_time`) VALUES (4, '{\"author\":\"xuzhitu\",\"charset\":\"UTF-8\",\"datasourceConfigId\":1,\"delPrefix\":\"t_\",\"packageName\":\"cloud.epx.raven\",\"tableNames\":[\"sys_dept\"],\"templateConfigIdList\":[5]}', '03819cf58bd7a0617c39498f9982112b', '2023-02-15 18:48:50');
INSERT INTO `generate_history` (`id`, `config_content`, `md5_value`, `generate_time`) VALUES (5, '{\"author\":\"xuzhitu\",\"charset\":\"UTF-8\",\"datasourceConfigId\":1,\"delPrefix\":\"t_\",\"packageName\":\"cloud.epx.raven\",\"tableNames\":[\"sys_dept\"],\"templateConfigIdList\":[1,2,3,4,5]}', '07c37d0809db8a9bbe0d8604f5957a52', '2023-02-21 09:54:55');
INSERT INTO `generate_history` (`id`, `config_content`, `md5_value`, `generate_time`) VALUES (6, '{\"author\":\"xuzhitu\",\"charset\":\"UTF-8\",\"datasourceConfigId\":2,\"delPrefix\":\"t_\",\"packageName\":\"cloud.epx.raven.pas\",\"tableNames\":[\"t_assessee\"],\"templateConfigIdList\":[1,2,3,4,5]}', '696050f5af27f491aed8202083a7200a', '2023-02-21 10:04:58');
INSERT INTO `generate_history` (`id`, `config_content`, `md5_value`, `generate_time`) VALUES (7, '{\"author\":\"xuzhitu\",\"charset\":\"UTF-8\",\"datasourceConfigId\":2,\"delPrefix\":\"t_\",\"packageName\":\"cloud.epx.raven\",\"tableNames\":[\"t_record_result\"],\"templateConfigIdList\":[6]}', '71dad2f4ad20c9e7914d406b05b09dfc', '2023-02-21 16:17:08');
INSERT INTO `generate_history` (`id`, `config_content`, `md5_value`, `generate_time`) VALUES (8, '{\"author\":\"xuzhitu\",\"charset\":\"UTF-8\",\"datasourceConfigId\":2,\"delPrefix\":\"t_\",\"packageName\":\"cloud.epx.raven\",\"tableNames\":[\"t_record_result\"],\"templateConfigIdList\":[9]}', '3cae9ff395e80e200dd13d22b10d3d70', '2023-02-21 16:11:48');
INSERT INTO `generate_history` (`id`, `config_content`, `md5_value`, `generate_time`) VALUES (9, '{\"author\":\"xuzhitu\",\"charset\":\"UTF-8\",\"datasourceConfigId\":2,\"delPrefix\":\"t_\",\"packageName\":\"cloud.epx.raven\",\"tableNames\":[\"t_assessee\"],\"templateConfigIdList\":[6,7,8,9,10,11]}', 'e88c42ab65b498525ffd3765fb38c9e0', '2023-02-21 14:57:10');
INSERT INTO `generate_history` (`id`, `config_content`, `md5_value`, `generate_time`) VALUES (10, '{\"author\":\"xuzhitu\",\"charset\":\"UTF-8\",\"datasourceConfigId\":2,\"delPrefix\":\"t_\",\"packageName\":\"cloud.epx.raven\",\"tableNames\":[\"t_record_result\"],\"templateConfigIdList\":[6,7,8,9,10,11,12,13,14,15,16,17]}', 'f843ec34b5cd0365a0bf0725c87f0fd1', '2023-02-21 15:32:35');
INSERT INTO `generate_history` (`id`, `config_content`, `md5_value`, `generate_time`) VALUES (11, '{\"author\":\"xuzhitu\",\"charset\":\"UTF-8\",\"datasourceConfigId\":2,\"delPrefix\":\"t_\",\"packageName\":\"cloud.epx.raven\",\"tableNames\":[\"t_assessee\"],\"templateConfigIdList\":[6,7,8,9,10,11,12,13,14,15,16,17]}', 'fee1e307ecc5b4b8c91a6700ffb013c9', '2023-02-21 15:43:23');
INSERT INTO `generate_history` (`id`, `config_content`, `md5_value`, `generate_time`) VALUES (12, '{\"author\":\"zyw\",\"charset\":\"UTF-8\",\"datasourceConfigId\":2,\"delPrefix\":\"t_\",\"packageName\":\"cloud.epx.raven\",\"tableNames\":[\"moss_library\",\"moss_norm_china\",\"moss_scale\",\"t_record\",\"t_record_result\",\"t_record_scales\"],\"templateConfigIdList\":[6,7,8,9,10,11,12,13,14,15,16,17]}', '4e4d5340bdcd6f8f77a7af47b2b9f756', '2023-02-21 15:46:21');
INSERT INTO `generate_history` (`id`, `config_content`, `md5_value`, `generate_time`) VALUES (13, '{\"author\":\"xuzhitu\",\"charset\":\"UTF-8\",\"datasourceConfigId\":2,\"delPrefix\":\"t_\",\"packageName\":\"cloud.epx.raven\",\"projectModule\":\"pas\",\"tableNames\":[\"t_record_result\"],\"templateConfigIdList\":[6]}', '2227bca39c14c18598bf694a5b39a479', '2023-02-21 16:32:14');
COMMIT;

-- ----------------------------
-- Table structure for template_config
-- ----------------------------
DROP TABLE IF EXISTS `template_config`;
CREATE TABLE `template_config` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '模板名称',
  `folder` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '目录名称',
  `file_name` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '文件名称',
  `content` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '内容',
  `is_deleted` int NOT NULL DEFAULT '0' COMMENT '是否删除，1：已删除，0：未删除',
  `group_id` int DEFAULT NULL,
  `group_name` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC COMMENT='模板表';

-- ----------------------------
-- Records of template_config
-- ----------------------------
BEGIN;
INSERT INTO `template_config` (`id`, `name`, `folder`, `file_name`, `content`, `is_deleted`, `group_id`, `group_name`) VALUES (1, 'entity', '', '${context.javaBeanName}.java', 'package ${context.packageName}.entity;\n\n#if(${table.hasDateField})\nimport java.util.Date;\n#end\n#if(${table.hasLocalDateField})\nimport java.time.LocalDate;\n#end\n#if(${table.hasLocalDateTimeField})\nimport java.time.LocalDateTime;\n#end\n#if(${table.hasBigDecimalField})\nimport java.math.BigDecimal;\n#end\n\n#if( \"${table.comment}\" != \"\" )\n/**\n * ${table.comment}\n */\n#end\npublic class ${context.javaBeanName} {\n#foreach($column in $columns)\n#if( \"${column.comment}\" != \"\" )\n	/** ${column.comment} */\n#end\n	private ${column.javaTypeBox} ${column.javaFieldName};\n#end\n\n#foreach(${column} in ${columns})\n	public void set${column.javaFieldNameUF}(${column.javaTypeBox} ${column.javaFieldName}) {\n		this.${column.javaFieldName} = ${column.javaFieldName};\n	}\n	\n	public ${column.javaTypeBox} get${column.javaFieldNameUF}() {\n		return this.${column.javaFieldName};\n	}\n	\n#end\n\n	@Override\n    public boolean equals(Object o) {\n        if (this == o) { return true; }\n        if (o == null || getClass() != o.getClass()) {return false;}\n        ${context.javaBeanName} that = (${context.javaBeanName}) o;\n        return ${pk.javaFieldName}.equals(that.${pk.javaFieldName});\n    }\n\n    @Override\n    public int hashCode() {\n        return java.util.Objects.hash(${pk.javaFieldName});\n    }\n    \n    @Override\n    public String toString() {\n        return \"${context.javaBeanName}{\" +\n#foreach(${column} in ${columns})\n		#if($velocityCount == 1)\n		\"${column.javaFieldName}=\" + ${column.javaFieldName} +\n		#else\n		\",${column.javaFieldName}=\'\" + ${column.javaFieldName} + \"\'\" + \n		#end\n#end\n                \'}\';\n    }\n	\n}', 0, 1, 'default');
INSERT INTO `template_config` (`id`, `name`, `folder`, `file_name`, `content`, `is_deleted`, `group_id`, `group_name`) VALUES (2, 'mybatis', '', '${context.javaBeanName}Mapper.xml', '#set($jq=\"$\")\n<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!DOCTYPE  mapper PUBLIC \"-//mybatis.org//DTD Mapper 3.0//EN\" \"http://mybatis.org/dtd/mybatis-3-mapper.dtd\" >\n<mapper namespace=\"${context.packageName}.mapper.${context.javaBeanName}Mapper\">\n	<resultMap id=\"BaseResultMap\" type=\"${context.packageName}.entity.${context.javaBeanName}\">\n    #foreach($column in $columns)    \n        <result column=\"${column.columnName}\" property=\"${column.javaFieldName}\" />\n	#end\n	</resultMap>  \n    \n    <!-- 表字段 -->\n    <sql id=\"baseColumns\">\n    #foreach($column in $columns)\n    #if($velocityCount > 1),#end t.${column.columnName}\n    #end\n    </sql> \n    \n    <!-- 查询全部 -->\n    <select id=\"listAll\" resultMap=\"BaseResultMap\">\n		SELECT         \n        	<include refid=\"baseColumns\" />\n		FROM ${table.tableName} t\n	</select>\n \n 	<!-- 根据主键获取单条记录 -->\n    <select id=\"getById\" resultMap=\"BaseResultMap\" parameterType=\"${pk.javaTypeBox}\">\n		SELECT         \n        	<include refid=\"baseColumns\" />\n		FROM ${table.tableName} t\n		WHERE ${pk.columnName} = #{${pk.javaFieldName}}\n	</select>\n\n	<!-- 插入全部字段 -->\n    <insert id=\"insert\" parameterType=\"${context.packageName}.entity.${context.javaBeanName}\"\n		keyProperty=\"${context.javaPkName}\" keyColumn=\"${context.pkName}\" useGeneratedKeys=\"true\"\n    >\n	INSERT INTO ${table.tableName}\n    <trim prefix=\"(\" suffix=\")\" suffixOverrides=\",\">	 \n    #foreach($column in $columns) \n    	#if(!${column.isIdentityPk}) \n    	${column.columnName},\n    	#end          \n    #end\n    </trim>\n    <trim prefix=\"VALUES (\" suffix=\")\" suffixOverrides=\",\">            \n    #foreach($column in $columns) \n    	#if(!${column.isIdentityPk})                     \n        #{${column.javaFieldName}},                   \n    	#end          \n    #end\n    </trim>\n	</insert>\n    \n    <!-- 插入不为NULL的字段 -->\n    <insert id=\"insertIgnoreNull\" parameterType=\"${context.packageName}.entity.${context.javaBeanName}\"\n        keyProperty=\"${pk.javaFieldName}\" keyColumn=\"${context.pkName}\" useGeneratedKeys=\"true\"\n        >\n        INSERT INTO ${table.tableName}    \n        <trim prefix=\"(\" suffix=\")\" suffixOverrides=\",\">	 \n\n            #foreach($column in $columns) \n                #if(!${column.isIdentityPk}) \n                    <if test=\"${column.javaFieldName} != null\">\n                   ${column.columnName},\n                    </if>\n                #end          \n            #end\n        </trim>\n        <trim prefix=\"VALUES (\" suffix=\")\" suffixOverrides=\",\">            \n            #foreach($column in $columns) \n                #if(!${column.isIdentityPk})  \n                    <if test=\"${column.javaFieldName} != null\" >\n                    #{${column.javaFieldName}},                    \n                    </if>\n                #end          \n            #end\n        </trim>\n    </insert>\n\n	<!-- 更新,更新全部字段 -->\n    <update id=\"update\" parameterType=\"${context.packageName}.entity.${context.javaBeanName}\">\n    UPDATE ${table.tableName}\n     <set>		\n     #foreach($column in $columns) \n         #if(!${column.isPk})               \n         ${column.columnName}=#{${column.javaFieldName}},        \n         #end          \n     #end\n     </set>	\n    WHERE ${pk.columnName} = #{${pk.javaFieldName}}\n    </update>  \n    \n    \n    <!-- 更新不为NULL的字段 -->\n    <update id=\"updateIgnoreNull\" parameterType=\"${context.packageName}.entity.${context.javaBeanName}\">\n    UPDATE ${table.tableName}\n    <set>\n    	#foreach($column in $columns) \n            #if(!${column.isPk})  \n                <if test=\"${column.javaFieldName} != null\" >\n                ${column.columnName}=#{${column.javaFieldName}},                 \n                </if>\n            #end          \n        #end\n    </set>\n    WHERE ${pk.columnName} = #{${pk.javaFieldName}}\n    </update>\n\n		\n	<!-- 根据主键删除记录 -->\n	<delete id=\"delete\" parameterType=\"${context.packageName}.entity.${context.javaBeanName}\">\n		UPDATE ${table.tableName}\n		SET is_deleted=1\n		WHERE ${pk.columnName} = #{${pk.javaFieldName}}\n	</delete>\n\n\n</mapper>', 0, 1, 'default');
INSERT INTO `template_config` (`id`, `name`, `folder`, `file_name`, `content`, `is_deleted`, `group_id`, `group_name`) VALUES (3, 'dao', '', '${context.javaBeanName}Mapper.java', 'package ${context.packageName}.mapper;\n\nimport java.util.List;\nimport org.apache.ibatis.annotations.Mapper;\nimport ${context.packageName}.entity.${context.javaBeanName};\n\n@Mapper\npublic interface ${context.javaBeanName}Mapper {\n\n	/**\n     * 查询所有记录\n     *\n     * @return 返回集合，没有返回空List\n     */\n	List<${context.javaBeanName}> listAll();\n\n\n	/**\n     * 根据主键查询\n     *\n     * @param id 主键\n     * @return 返回记录，没有返回null\n     */\n	${context.javaBeanName} getById(${pk.javaTypeBox} ${pk.javaFieldName});\n	\n	/**\n     * 新增，插入所有字段\n     *\n     * @param ${context.javaBeanNameLF} 新增的记录\n     * @return 返回影响行数\n     */\n	int insert(${context.javaBeanName} ${context.javaBeanNameLF});\n	\n	/**\n     * 新增，忽略null字段\n     *\n     * @param ${context.javaBeanNameLF} 新增的记录\n     * @return 返回影响行数\n     */\n	int insertIgnoreNull(${context.javaBeanName} ${context.javaBeanNameLF});\n	\n	/**\n     * 修改，修改所有字段\n     *\n     * @param ${context.javaBeanNameLF} 修改的记录\n     * @return 返回影响行数\n     */\n	int update(${context.javaBeanName} ${context.javaBeanNameLF});\n	\n	/**\n     * 修改，忽略null字段\n     *\n     * @param ${context.javaBeanNameLF} 修改的记录\n     * @return 返回影响行数\n     */\n	int updateIgnoreNull(${context.javaBeanName} ${context.javaBeanNameLF});\n	\n	/**\n     * 删除记录\n     *\n     * @param ${context.javaBeanNameLF} 待删除的记录\n     * @return 返回影响行数\n     */\n	int delete(${context.javaBeanName} ${context.javaBeanNameLF});\n	\n}', 0, 1, 'default');
INSERT INTO `template_config` (`id`, `name`, `folder`, `file_name`, `content`, `is_deleted`, `group_id`, `group_name`) VALUES (4, 'service', '', '${context.javaBeanName}Service', 'package ${context.packageName}.mapper;\n\nimport ${context.packageName}.entity.${context.javaBeanName};\nimport ${context.packageName}.mapper.${context.javaBeanName}Mapper;\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.stereotype.Service;\n\nimport java.util.List;\n\n@Service\npublic class ${context.javaBeanName}Service {\n\n    @Autowired\n    private ${context.javaBeanName}Mapper ${context.javaBeanNameLF}Mapper;\n\n    /**\n     * 查询所有记录\n     *\n     * @return 返回集合，没有返回空List\n     */\n    public List<${context.javaBeanName}> listAll() {\n    	return ${context.javaBeanNameLF}Mapper.listAll();\n    }\n\n\n    /**\n     * 根据主键查询\n     *\n     * @param id 主键\n     * @return 返回记录，没有返回null\n     */\n    public ${context.javaBeanName} getById(${pk.javaTypeBox} ${pk.javaFieldName}) {\n    	return ${context.javaBeanNameLF}Mapper.getById(${pk.javaFieldName});\n    }\n	\n    /**\n     * 新增，插入所有字段\n     *\n     * @param ${context.javaBeanNameLF} 新增的记录\n     * @return 返回影响行数\n     */\n    public int insert(${context.javaBeanName} ${context.javaBeanNameLF}) {\n    	return ${context.javaBeanNameLF}Mapper.insert(${context.javaBeanNameLF});\n    }\n	\n    /**\n     * 新增，忽略null字段\n     *\n     * @param ${context.javaBeanNameLF} 新增的记录\n     * @return 返回影响行数\n     */\n    public int insertIgnoreNull(${context.javaBeanName} ${context.javaBeanNameLF}) {\n    	return ${context.javaBeanNameLF}Mapper.insertIgnoreNull(${context.javaBeanNameLF});\n    }\n	\n    /**\n     * 修改，修改所有字段\n     *\n     * @param ${context.javaBeanNameLF} 修改的记录\n     * @return 返回影响行数\n     */\n    public int update(${context.javaBeanName} ${context.javaBeanNameLF}) {\n    	return ${context.javaBeanNameLF}Mapper.update(${context.javaBeanNameLF});\n    }\n	\n    /**\n     * 修改，忽略null字段\n     *\n     * @param ${context.javaBeanNameLF} 修改的记录\n     * @return 返回影响行数\n     */\n    public int updateIgnoreNull(${context.javaBeanName} ${context.javaBeanNameLF}) {\n    	return ${context.javaBeanNameLF}Mapper.updateIgnoreNull(${context.javaBeanNameLF});\n    }\n	\n    /**\n     * 删除记录\n     *\n     * @param ${context.javaBeanNameLF} 待删除的记录\n     * @return 返回影响行数\n     */\n    public int delete(${context.javaBeanName} ${context.javaBeanNameLF}) {\n    	return ${context.javaBeanNameLF}Mapper.delete(${context.javaBeanNameLF});\n    }\n	\n}', 0, 1, 'default');
INSERT INTO `template_config` (`id`, `name`, `folder`, `file_name`, `content`, `is_deleted`, `group_id`, `group_name`) VALUES (5, 'controller', '', '${context.javaBeanName}Controller', 'package ${context.packageName}.mapper;\n\nimport java.util.List;\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.web.bind.annotation.RequestMapping;\nimport org.springframework.web.bind.annotation.RequestBody;\nimport org.springframework.web.bind.annotation.RestController;\n\nimport ${context.packageName}.entity.${context.javaBeanName};\nimport ${context.packageName}.service.${context.javaBeanName}Service;\n\n@RestController\npublic class ${context.javaBeanName}Controller {\n\n    @Autowired\n    private ${context.javaBeanName}Service ${context.javaBeanNameLF}Service;\n\n    /**\n     * 查询所有记录\n     *\n     * @return 返回集合，没有返回空List\n     */\n    @RequestMapping(\"list\")\n    public List<${context.javaBeanName}> listAll() {\n        return ${context.javaBeanNameLF}Service.listAll();\n    }\n\n\n    /**\n     * 根据主键查询\n     *\n     * @param id 主键\n     * @return 返回记录，没有返回null\n     */\n    @RequestMapping(\"getById\")\n    public ${context.javaBeanName} getById(${pk.javaTypeBox} ${pk.javaFieldName}) {\n        return ${context.javaBeanNameLF}Service.getById(${pk.javaFieldName});\n    }\n    \n    /**\n     * 新增，插入所有字段\n     *\n     * @param ${context.javaBeanNameLF} 新增的记录\n     * @return 返回影响行数\n     */\n    @RequestMapping(\"insert\")\n    public int insert(@RequestBody ${context.javaBeanName} ${context.javaBeanNameLF}) {\n        return ${context.javaBeanNameLF}Service.insert(${context.javaBeanNameLF});\n    }\n    \n    /**\n     * 新增，忽略null字段\n     *\n     * @param ${context.javaBeanNameLF} 新增的记录\n     * @return 返回影响行数\n     */\n    @RequestMapping(\"insert\")\n    public int insertIgnoreNull(@RequestBody ${context.javaBeanName} ${context.javaBeanNameLF}) {\n        return ${context.javaBeanNameLF}Service.insertIgnoreNull(${context.javaBeanNameLF});\n    }\n    \n    /**\n     * 修改，修改所有字段\n     *\n     * @param ${context.javaBeanNameLF} 修改的记录\n     * @return 返回影响行数\n     */\n    @RequestMapping(\"update\")\n    public int update(@RequestBody ${context.javaBeanName} ${context.javaBeanNameLF}) {\n        return ${context.javaBeanNameLF}Service.update(${context.javaBeanNameLF});\n    }\n    \n    /**\n     * 修改，忽略null字段\n     *\n     * @param ${context.javaBeanNameLF} 修改的记录\n     * @return 返回影响行数\n     */\n    @RequestMapping(\"updateIgnoreNull\")\n    public int updateIgnoreNull(@RequestBody ${context.javaBeanName} ${context.javaBeanNameLF}) {\n        return ${context.javaBeanNameLF}Service.updateIgnoreNull(${context.javaBeanNameLF});\n    }\n    \n    /**\n     * 删除记录\n     *\n     * @param ${context.javaBeanNameLF} 待删除的记录\n     * @return 返回影响行数\n     */\n    @RequestMapping(\"delete\")\n    public int delete(@RequestBody ${context.javaBeanName} ${context.javaBeanNameLF}) {\n        return ${context.javaBeanNameLF}Service.delete(${context.javaBeanNameLF});\n    }\n    \n}', 0, 1, 'default');
INSERT INTO `template_config` (`id`, `name`, `folder`, `file_name`, `content`, `is_deleted`, `group_id`, `group_name`) VALUES (6, 'Controller', 'controller', '${context.javaBeanName}Controller.java', 'package ${context.packageName}.${context.projectModule}.controller;\n\nimport com.baomidou.mybatisplus.core.toolkit.Wrappers;\nimport com.baomidou.mybatisplus.extension.plugins.pagination.Page;\nimport cloud.epx.raven.common.core.util.R;\nimport cloud.epx.raven.common.log.annotation.SysLog;\nimport ${context.packageName}.${context.projectModule}.entity.${context.javaBeanName};\nimport ${context.packageName}.${context.projectModule}.service.${context.javaBeanName}Service;\nimport org.springframework.security.access.prepost.PreAuthorize;\nimport io.swagger.annotations.Api;\nimport io.swagger.annotations.ApiOperation;\nimport lombok.AllArgsConstructor;\nimport org.springframework.web.bind.annotation.*;\n\n/**\n * ${table.comment}\n *\n * @author ${context.author}\n * @date ${context.datetime}\n */\n@RestController\n@AllArgsConstructor\n@RequestMapping(\"/${context.javaBeanNameL}\" )\n@Api(value = \"${context.javaBeanNameL}\", tags = \"${table.comment}管理\")\npublic class ${context.javaBeanName}Controller {\n\n    private final  ${context.javaBeanName}Service ${context.javaBeanNameLF}Service;\n\n    /**\n     * 分页查询\n     * @param page 分页对象\n     * @param ${context.javaBeanNameLF} ${table.comment}\n     * @return\n     */\n    @ApiOperation(value = \"分页查询\", notes = \"分页查询\")\n    @GetMapping(\"/page\" )\n    @PreAuthorize(\"@pms.hasPermission(\'${context.projectModule}_${context.javaBeanNameL}_view\')\" )\n    public R get${context.javaBeanName}Page(Page page, ${context.javaBeanName} ${context.javaBeanNameLF}) {\n        return R.ok(${context.javaBeanNameLF}Service.page(page, Wrappers.query(${context.javaBeanNameLF})));\n    }\n\n    /**\n     * 通过id查询${table.comment}\n     * @param ${pk.javaFieldName} id\n     * @return R\n     */\n    @ApiOperation(value = \"通过id查询\", notes = \"通过id查询\")\n    @GetMapping(\"/{${pk.javaFieldName}}\" )\n    @PreAuthorize(\"@pms.hasPermission(\'${context.projectModule}_${context.javaBeanNameL}_view\')\" )\n    public R getById(@PathVariable(\"${pk.javaFieldName}\" ) ${pk.javaTypeBox} ${pk.javaFieldName}) {\n        return R.ok(${context.javaBeanNameLF}Service.getById(${pk.javaFieldName}));\n    }\n\n    /**\n     * 新增${table.comment}\n     * @param ${context.javaBeanNameLF} ${table.comment}\n     * @return R\n     */\n    @ApiOperation(value = \"新增${table.comment}\", notes = \"新增${table.comment}\")\n    @SysLog(\"新增${table.comment}\" )\n    @PostMapping\n    @PreAuthorize(\"@pms.hasPermission(\'${context.projectModule}_${context.javaBeanNameL}_add\')\" )\n    public R save(@RequestBody ${context.javaBeanName} ${context.javaBeanNameLF}) {\n        return R.ok(${context.javaBeanNameLF}Service.save(${context.javaBeanNameLF}));\n    }\n\n    /**\n     * 修改${table.comment}\n     * @param ${context.javaBeanNameLF} ${table.comment}\n     * @return R\n     */\n    @ApiOperation(value = \"修改${table.comment}\", notes = \"修改${table.comment}\")\n    @SysLog(\"修改${table.comment}\" )\n    @PutMapping\n    @PreAuthorize(\"@pms.hasPermission(\'${context.projectModule}_${context.javaBeanNameL}_edit\')\" )\n    public R updateById(@RequestBody ${context.javaBeanName} ${context.javaBeanNameLF}) {\n        return R.ok(${context.javaBeanNameLF}Service.updateById(${context.javaBeanNameLF}));\n    }\n\n    /**\n     * 通过id删除${table.comment}\n     * @param ${pk.javaFieldName} id\n     * @return R\n     */\n    @ApiOperation(value = \"通过id删除${table.comment}\", notes = \"通过id删除${table.comment}\")\n    @SysLog(\"通过id删除${table.comment}\" )\n    @DeleteMapping(\"/{${pk.javaFieldName}}\" )\n    @PreAuthorize(\"@pms.hasPermission(\'${context.projectModule}_${context.javaBeanNameL}_del\')\" )\n    public R removeById(@PathVariable ${pk.javaTypeBox} ${pk.javaFieldName}) {\n        return R.ok(${context.javaBeanNameLF}Service.removeById(${pk.javaFieldName}));\n    }\n\n}\n', 0, 2, '');
INSERT INTO `template_config` (`id`, `name`, `folder`, `file_name`, `content`, `is_deleted`, `group_id`, `group_name`) VALUES (7, 'Service', 'service', '${context.javaBeanName}Service.java', 'package ${context.packageName}.${context.projectModule}.service;\n\nimport com.baomidou.mybatisplus.extension.service.IService;\nimport ${context.packageName}.${context.projectModule}.entity.${context.javaBeanName};\n\n/**\n * ${table.comment}\n *\n * @author ${context.author}\n * @date ${context.datetime}\n */\npublic interface ${context.javaBeanName}Service extends IService<${context.javaBeanName}> {\n\n}', 0, 2, '');
INSERT INTO `template_config` (`id`, `name`, `folder`, `file_name`, `content`, `is_deleted`, `group_id`, `group_name`) VALUES (8, 'ServiceImpl', 'service/impl', '${context.javaBeanName}ServiceImpl.java', 'package ${context.packageName}.${context.projectModule}.service.impl;\n\nimport com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;\nimport ${context.packageName}.${context.projectModule}.entity.${context.javaBeanName};\nimport ${context.packageName}.${context.projectModule}.mapper.${context.javaBeanName}Mapper;\nimport ${context.packageName}.${context.projectModule}.service.${context.javaBeanName}Service;\nimport org.springframework.stereotype.Service;\n\n/**\n * ${table.comment}\n *\n * @author ${context.author}\n * @date ${context.datetime}\n */\n@Service\npublic class ${context.javaBeanName}ServiceImpl extends ServiceImpl<${context.javaBeanName}Mapper, ${context.javaBeanName}> implements ${context.javaBeanName}Service {\n\n}\n', 0, 2, '');
INSERT INTO `template_config` (`id`, `name`, `folder`, `file_name`, `content`, `is_deleted`, `group_id`, `group_name`) VALUES (9, 'Entity', 'entity', '${context.javaBeanName}.java', 'package ${context.packageName}.${context.projectModule}.entity;\n\nimport com.baomidou.mybatisplus.annotation.TableId;\nimport com.baomidou.mybatisplus.annotation.TableName;\nimport com.baomidou.mybatisplus.extension.activerecord.Model;\nimport io.swagger.annotations.ApiModel;\nimport io.swagger.annotations.ApiModelProperty;\nimport lombok.Data;\nimport lombok.EqualsAndHashCode;\nimport java.math.BigDecimal;\nimport java.io.Serializable;\nimport java.time.LocalDateTime;\n\n/**\n * ${table.comment}\n *\n * @author ${context.author}\n * @date ${context.datetime}\n */\n@Data\n@TableName(\"${table.tableName}\")\n@EqualsAndHashCode(callSuper = true)\n@ApiModel(value = \"${table.comment}\")\npublic class ${context.javaBeanName} extends Model<${context.javaBeanName}> {\n	private static final long serialVersionUID = 1L;\n\n    #foreach ($column in $columns)\n/**\n     * $column.comment\n     */\n    #if($column.isPk)\n@TableId\n    #end\n    #if(\"${column.javaTypeBox}\"==\"Date\")\n@ApiModelProperty(value=\"$column.comment\"#if($column.hidden),hidden=$column.hidden#end)\n	private LocalDate ${column.javaFieldName};\n    #elseif(\"${column.javaTypeBox}\"==\"DateTime\")\n@ApiModelProperty(value=\"$column.comment\"#if($column.hidden),hidden=$column.hidden#end)\n	private LocalDateTime ${column.javaFieldName};\n	#elseif(\"${column.javaTypeBox}\"==\"String\"&&${column.maxLength}==0)\n@ApiModelProperty(value=\"$column.comment\"#if($column.hidden),hidden=$column.hidden#end)\n	private ${column.javaTypeBox} ${column.javaFieldName};\n	#elseif(\"${column.javaTypeBox}\"==\"BigDecimal\")\n@Column(scale = ${column.scale}, precision = ${column.maxLength})\n@ApiModelProperty(value=\"$column.comment\"#if($column.hidden),hidden=$column.hidden#end)\n	private BigDecimal ${column.javaFieldName};\n	#else\n@ApiModelProperty(value=\"$column.comment\"#if($column.hidden),hidden=$column.hidden#end)\n    private $column.javaTypeBox ${column.javaFieldName};\n    \n    #end\n    \n    #end\n}\n', 0, 2, '');
INSERT INTO `template_config` (`id`, `name`, `folder`, `file_name`, `content`, `is_deleted`, `group_id`, `group_name`) VALUES (10, 'Mapper', 'mapper', '${context.javaBeanName}Mapper.java', 'package ${context.packageName}.${context.projectModule}.mapper;\n\n\nimport ${context.packageName}.${context.projectModule}.entity.${context.javaBeanName};\nimport com.baomidou.mybatisplus.core.mapper.BaseMapper;\nimport org.apache.ibatis.annotations.Mapper;\n\n/**\n*  ${table.comment} Mapper\n* @author ${context.author}\n* @date ${context.datetime}\n*/\n\n@Mapper\npublic interface ${context.javaBeanName}Mapper extends BaseMapper<${context.javaBeanName}> {\n}\n\n', 0, 2, '');
INSERT INTO `template_config` (`id`, `name`, `folder`, `file_name`, `content`, `is_deleted`, `group_id`, `group_name`) VALUES (11, 'Mapper-xml', 'resources/mapper', '${context.javaBeanName}Mapper.xml', '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<!DOCTYPE mapper PUBLIC \"-//mybatis.org//DTD Mapper 3.0//EN\" \"http://mybatis.org/dtd/mybatis-3-mapper.dtd\">\n\n<mapper namespace=\"${context.packageName}.${context.projectModule}.mapper.${context.javaBeanName}Mapper\">\n\n  <resultMap id=\"${context.javaBeanNameLF}Map\" type=\"${context.packageName}.${context.projectModule}.entity.${context.javaBeanName}\">\n    #foreach($column in $columns)\n      #if($column.isPk)\n        <id property=\"${pk.columnName}\" column=\"${pk.javaFieldName}\"/>\n      #else\n        <result property=\"${column.columnName}\" column=\"${column.javaFieldName}\"/>\n      #end\n    #end\n  </resultMap>\n</mapper>\n', 0, 2, '');
INSERT INTO `template_config` (`id`, `name`, `folder`, `file_name`, `content`, `is_deleted`, `group_id`, `group_name`) VALUES (12, 'Menu', 'menu', 'menu.sql', '-- 该脚本不要直接执行， 注意维护菜单的父节点ID 默认 父节点1000 , 默认租户 1\n\n-- 菜单SQL\ninsert into `sys_menu` ( `parent_id`, `path`, `permission`, `type`, `icon`, `del_flag`, `create_time`, `sort`, `update_time`, `name`, `tenant_id`)\n    values ( \'1000\', \'/${context.projectModule}/${context.javaBeanNameL}/index\', \'\', \'0\', \'icon-bangzhushouji\', \'0\', \'${context.datetime}\', \'8\', \'${context.datetime}\', \'${table.comment}管理\', 1);\n\n-- 按钮父菜单ID\nset @parentId = @@identity;\n\n-- 菜单对应按钮SQL\ninsert into `sys_menu` ( `parent_id`, `permission`, `type`, `path`, `icon`, `del_flag`, `create_time`, `sort`, `update_time`, `name`, `tenant_id`)\n    SELECT @parentId, \'${context.projectModule}_${context.javaBeanNameL}_view\', \'1\', null, \'1\',  \'0\', \'${context.datetime}\', \'0\', \'${context.datetime}\', \'${table.comment}查看\', 1;\ninsert into `sys_menu` ( `parent_id`, `permission`, `type`, `path`, `icon`, `del_flag`, `create_time`, `sort`, `update_time`, `name`, `tenant_id`)\n    SELECT @parentId, \'${context.projectModule}_${context.javaBeanNameL}_add\', \'1\', null, \'1\',  \'0\', \'${context.datetime}\', \'1\', \'${context.datetime}\', \'${table.comment}新增\', 1;\ninsert into `sys_menu` ( `parent_id`, `permission`, `type`, `path`, `icon`,  `del_flag`, `create_time`, `sort`, `update_time`, `name`, `tenant_id`)\n    SELECT @parentId, \'${context.projectModule}_${context.javaBeanNameL}_edit\', \'1\', null, \'1\',  \'0\', \'${context.datetime}\', \'2\', \'${context.datetime}\', \'${table.comment}修改\', 1;\ninsert into `sys_menu` ( `parent_id`, `permission`, `type`, `path`, `icon`, `del_flag`, `create_time`, `sort`, `update_time`, `name`, `tenant_id`)\n    SELECT @parentId, \'${context.projectModule}_${context.javaBeanNameL}_del\', \'1\', null, \'1\',  \'0\', \'${context.datetime}\', \'3\', \'${context.datetime}\', \'${table.comment}删除\', 1;\n', 0, 2, '');
INSERT INTO `template_config` (`id`, `name`, `folder`, `file_name`, `content`, `is_deleted`, `group_id`, `group_name`) VALUES (13, 'Api', 'apis/${context.projectModule}', '${context.javaBeanNameL}.ts', 'import type { ResponsePageResult, ResponseResult } from \'@/types/response\'\nimport { http } from \'@/plugins/axios\'\nimport type { PageType } from \'@/types/page\'\nimport type { DictType } from \'@/types/admin/dict\'\nimport type { ${context.javaBeanName} } from \'@/types/${context.projectModule}/${context.javaBeanNameL}\'\n\nexport function fetchPageList(query: PageType & ${context.javaBeanName}) {\n  return http.request<${context.javaBeanName}, ResponsePageResult<${context.javaBeanName}>>({\n    url: \'/${context.projectModule}/${context.javaBeanNameLF}/page\',\n    method: \'get\',\n    params: query,\n  })\n}\n\nexport function addObj(obj: ${context.javaBeanName}) {\n  return http.request<boolean>({\n    url: \'/${context.projectModule}/${context.javaBeanNameLF}\',\n    method: \'post\',\n    data: obj,\n  })\n}\n\nexport function getObj(id: number) {\n  return http.request<${context.javaBeanName}>({\n    url: \'/${context.projectModule}/${context.javaBeanNameLF}/\' + id,\n    method: \'get\',\n  })\n}\n\nexport function delObj(id: number) {\n  return http.request<boolean>({\n    url: \'/${context.projectModule}/${context.javaBeanNameLF}/\' + id,\n    method: \'delete\',\n  })\n}\n\nexport function putObj(obj: ${context.javaBeanName}) {\n  return http.request<boolean>({\n    url: \'/${context.projectModule}/${context.javaBeanNameLF}\',\n    method: \'put\',\n    data: obj,\n  })\n}\n', 0, 2, '');
INSERT INTO `template_config` (`id`, `name`, `folder`, `file_name`, `content`, `is_deleted`, `group_id`, `group_name`) VALUES (14, 'Type', 'types/${context.projectModule}', '${context.javaBeanNameL}.ts', '#foreach($column in $columns)\n#if( \"${column.javaType}\" == \"Date\" )\n${column.javaFieldName}:string\n#else\n#if( \"${column.javaType}\" == \"int\" )\n${column.javaFieldName}:number\n#else\n${column.javaFieldName}:${column.javaType}\n#end\n#end\n#end\n}', 0, 2, '');
INSERT INTO `template_config` (`id`, `name`, `folder`, `file_name`, `content`, `is_deleted`, `group_id`, `group_name`) VALUES (15, 'Crud', 'constant/crud', '${context.javaBeanNameL}.ts', 'import type { FormRules } from \'naive-ui\'\n\nconst rules: FormRules = {\n#foreach($column in $columns)\n\n#if(!${column.isPk})\n#if( \"${column.javaType}\" == \"Date\" )\n  ${column.javaFieldName}: [\n    {\n      type: \'string\',\n      required: false,\n      message: \'请选择${column.comment}\',\n      trigger: [\'blur\', \'change\'],\n    },\n  ],\n#else\n#if( \"${column.javaType}\" == \"int\" )\n  ${column.javaFieldName}: [\n    {\n      type: \'number\',\n      required: false,\n      message: \'请选择${column.comment}\',\n      trigger: [\'blur\', \'change\'],\n    },\n  ],\n#else\n  ${column.javaFieldName}: [\n    {\n      type: \'${column.javaType}\',\n      required: false,\n      message: \'请选择${column.comment}\',\n      trigger: [\'blur\', \'change\'],\n    },\n  ],\n#end\n#end\n#end\n#end\n\n}\n\nexport { rules }', 0, 2, '');
INSERT INTO `template_config` (`id`, `name`, `folder`, `file_name`, `content`, `is_deleted`, `group_id`, `group_name`) VALUES (16, 'VueIndex', 'views/${context.projectModule}/${context.javaBeanNameL}', 'index.vue', '<script setup lang=\"ts\">\n  import { NButton, NSpace, useDialog, useMessage, type DataTableColumns, type PaginationInfo } from \'naive-ui\'\n  import { computed, ref, reactive, h } from \'vue\'\n  import { useRoute, useRouter } from \'vue-router\'\n  import { useElementSize } from \'@vueuse/core\'\n  import { validateAuth } from \'@/util/validate\'\n  import type { ${context.javaBeanName} } from \'@/types/${context.projectModule}/${context.javaBeanNameL}\'\n  import { pageSizesCustom } from \'@/constant/pageConstant\'\n  import { fetchPageList, delObj } from \'@/apis/${context.projectModule}/${context.javaBeanNameL}\'\n\n  const router = useRouter()\n  const route = useRoute()\n  const message = useMessage()\n  const dialog = useDialog()\n\n  //传参id\n  const id = route.query.id ? ref(Number(route.query.id)) : ref()\n\n  //适配高度\n  const boxEl = ref(null)\n  const { height } = useElementSize(boxEl)\n\n  const tableHeight = computed(() => {\n    return height.value - 180\n  })\n\n  // 权限\n  const permissionList: any = computed(() => {\n    return {\n      viewBtn: validateAuth(\'${context.projectModule}_${context.javaBeanNameL}_view\', false),\n      addBtn: validateAuth(\'${context.projectModule}_${context.javaBeanNameL}_add\', false),\n      editBtn: validateAuth(\'${context.projectModule}_${context.javaBeanNameL}_edit\', false),\n      delBtn: validateAuth(\'${context.projectModule}_${context.javaBeanNameL}_del\', false),\n    }\n  })\n\n  // 列表配置\n  const data = ref<${context.javaBeanName}[]>([])\n  const loading = ref<boolean>(false)\n  const pagination = reactive({\n    page: 1,\n    pageCount: 1,\n    pageSize: 10,\n    showSizePicker: true,\n    pageSizes: pageSizesCustom,\n    itemCount: 0,\n    prefix({ itemCount }: PaginationInfo) {\n      return `合计 ${itemCount} 条`\n    },\n  })\n  const createColumns = ({\n    viewData,\n    editData,\n    delData,\n  }: {\n    viewData: (rowData: ${context.javaBeanName}) => void\n    editData: (rowData: ${context.javaBeanName}) => void\n    delData: (rowData: ${context.javaBeanName}) => void\n  }): DataTableColumns<${context.javaBeanName}> => {\n    return [\n      {\n        title: \'#\',\n        align: \'center\',\n        key: \'id\',\n        width: 80,\n        align: \'center\',\n        fixed: \'left\',\n        render: (_, index) => {\n          return `${(pagination.page - 1) * pagination.pageSize + index + 1}`\n        },\n      },\n#foreach($column in $columns)\n#if(!${column.isPk}&&\"${column.javaFieldName}\"!=\"unitId\"&&\"${column.javaFieldName}\"!=\"deptId\"&&\"${column.javaFieldName}\"!=\"unitName\"&&\"${column.javaFieldName}\"!=\"deptName\")\n       {\n        title: \'${column.comment}\',\n        align: \'center\',\n        key: \'${column.javaFieldName}\',\n      },\n#end\n#end\n      {\n        title: \'操作\',\n        align: \'center\',\n        fixed: \'right\',\n        key: \'actions\',\n        width: 200,\n        render(row) {\n          return h(NSpace, null, {\n            default: () => {\n              const columnBtn = [\n                h(\n                  NButton,\n                  {\n                    size: \'small\',\n                    strong: true,\n                    tertiary: true,\n                    onClick: () => viewData(row),\n                  },\n                  { default: () => \'查看\' }\n                ),\n              ]\n              if (permissionList.value.editBtn) {\n                columnBtn.push(\n                  h(\n                    NButton,\n                    {\n                      size: \'small\',\n                      strong: true,\n                      tertiary: true,\n                      onClick: () => editData(row),\n                    },\n                    { default: () => \'编辑\' }\n                  )\n                )\n              }\n              if (permissionList.value.delBtn) {\n                columnBtn.push(\n                  h(\n                    NButton,\n                    {\n                      size: \'small\',\n                      strong: true,\n                      tertiary: true,\n                      onClick: () => {\n                        dialog.warning({\n                          title: \'提示\',\n                          content: \'确定删除该记录吗？\',\n                          positiveText: \'确定\',\n                          negativeText: \'取消\',\n                          onPositiveClick: () => {\n                            delData(row)\n                          },\n                          onNegativeClick: () => {},\n                        })\n                      },\n                    },\n                    { default: () => \'删除\' }\n                  )\n                )\n              }\n              return columnBtn\n            },\n          })\n        },\n      },\n    ]\n  }\n  const columns = ref(\n    createColumns({\n      viewData(rowData) {\n        router.push({ name: \'${context.projectModule}-${context.javaBeanNameL}-view\', query: { id: rowData.id } })\n      },\n      editData(rowData) {\n        router.push({ name: \'${context.projectModule}-${context.javaBeanNameL}-form\', query: { id: rowData.id } })\n      },\n      delData(rowData) {\n        del${context.javaBeanName}(rowData.id)\n      },\n    })\n  )\n\n  // 新增${table.comment}跳转\n  const handleAddForm = () => {\n    router.push({ name: \'${context.projectModule}-${context.javaBeanNameL}-form\' })\n  }\n\n  // 获取${table.comment}列表\n  async function getList(params?: any) {\n    loading.value = true\n    const result = await fetchPageList(\n      Object.assign(\n        {\n          current: pagination.page,\n          size: pagination.pageSize,\n        },\n        params\n      ) as any\n    )\n    pagination.itemCount = result.data.total\n    data.value = result.data.records\n    loading.value = false\n  }\n\n  async function del${context.javaBeanName}(id: number) {\n    const result = await delObj(id)\n    if (result.data) {\n      message.success(\'已删除\')\n      getList()\n    } else {\n      message.error(\'删除失败\')\n    }\n  }\n\n  function handlePageChange(page: number) {\n    pagination.page = page\n    getList()\n  }\n\n  function handlePageSizeChange(pageSize: number) {\n    pagination.pageSize = pageSize\n    pagination.page = 1\n    getList()\n  }\n\n  getList()\n</script>\n<template>\n  <BaseBox ref=\"boxEl\">\n    <n-space vertical>\n      <n-card size=\"small\">\n        <HeaderTab nav-title=\"${table.comment}\"></HeaderTab>\n      </n-card>\n      <n-card size=\"small\">\n        <n-space vertical>\n          <n-space justify=\"space-between\">\n            <div>\n              <n-button v-if=\"permissionList.addBtn\" type=\"primary\" secondary @click=\"handleAddForm\">\n                <template #icon>\n                  <n-icon>\n                    <i class=\"fa-duotone fa-plus\"></i>\n                  </n-icon>\n                </template>\n                新增${table.comment}\n              </n-button>\n            </div>\n            <n-button secondary circle @click=\"getList()\">\n              <template #icon>\n                <i class=\"fa-duotone fa-refresh text-sm text-plaid-primary\"></i>\n              </template>\n            </n-button>\n          </n-space>\n          <n-data-table\n            remote\n            :scroll-x=\"1600\"\n            :bordered=\"false\"\n            :single-line=\"false\"\n            size=\"small\"\n            :loading=\"loading\"\n            :columns=\"columns\"\n            :data=\"data\"\n            :pagination=\"pagination\"\n            @update:page=\"handlePageChange\"\n            @update:page-size=\"handlePageSizeChange\"\n            :style=\"{ height: `${tableHeight}px` }\"\n            flex-height />\n        </n-space>\n      </n-card>\n    </n-space>\n  </BaseBox>\n</template>\n<style lang=\"scss\" scoped></style>\n', 0, 2, '');
INSERT INTO `template_config` (`id`, `name`, `folder`, `file_name`, `content`, `is_deleted`, `group_id`, `group_name`) VALUES (17, 'VueForm', 'views/${context.projectModule}/${context.javaBeanNameL}', 'form.vue', '<script setup lang=\"ts\">\n  import { ref } from \'vue\'\n  import { useRoute, useRouter } from \'vue-router\'\n  import { useMessage, type FormInst } from \'naive-ui\'\n  import { addObj, getObj, putObj , dictByType} from \'@/apis/${context.projectModule}/${context.javaBeanNameL}\'\n  import { rules } from \'@/constant/crud/${context.projectModule}/${context.javaBeanNameL}\'\n  import type { ${context.javaBeanName} } from \'@/types/${context.projectModule}/${context.javaBeanNameL}\'\n  import useUnit from \'@/composables/admin/useUnit\'\n  import type { UnitTree } from \'@/types/admin/unit\'\n  import type { DeptData } from \'@/types/admin/dept\'\n  import useDept from \'@/composables/admin/useDept\'\n  import type { DictType } from \'@/types/admin/dict\'\n\n  const message = useMessage()\n  const router = useRouter()\n  const route = useRoute()\n  const { getScopeUnitTree } = useUnit()\n  const { getAllDeptTree } = useDept()\n  const formRef = ref<FormInst | null>(null)\n\n  const id = route.query.id ? ref(Number(route.query.id)) : ref()\n  let form = ref<${context.javaBeanName}>({} as ${context.javaBeanName})\n  const unitTreeData = ref<UnitTree[]>([])\n  const deptTreeData = ref<DeptData[]>([])\n\n  // 字典类型\n  const projectTypeOpt = ref<DictType[]>([])\n  const getTypeDictByType = async (type: string) => {\n    const { data } = await dictByType(type)\n    projectTypeOpt.value = data\n  }\n  getTypeDictByType(\'${context.projectModule}_${context.javaBeanNameL}_type\')\n  // 字典状态\n  const projectStatusOpt = ref<DictType[]>([])\n  const getStatusDictByType = async (type: string) => {\n    const { data } = await dictByType(type)\n    projectStatusOpt.value = data\n  }\n  getStatusDictByType(\'${context.projectModule}_${context.javaBeanNameL}_status\')\n\n  async function get${context.javaBeanName}(id: number) {\n    if (id) {\n      const result = await getObj(id)\n      form.value = result.data\n    }\n  }\n\n  async function save${context.javaBeanName}(form: ${context.javaBeanName}) {\n    const result = await addObj(form)\n    if (result.data) {\n      message.success(\'添加成功\')\n      handleBack()\n    } else {\n      message.error(\'添加失败\')\n    }\n  }\n\n  async function update${context.javaBeanName}(form: ${context.javaBeanName}) {\n    const result = await putObj(form)\n    if (result.data) {\n      message.success(\'更新成功\')\n      handleBack()\n    } else {\n      message.error(\'更新失败\')\n    }\n  }\n\n  function handleValidateSave(e: MouseEvent) {\n    e.preventDefault()\n    formRef.value?.validate((errors) => {\n      if (!errors) {\n        save${context.javaBeanName}(form.value)\n      } else {\n        message.warning(\'请填入必填项！\')\n      }\n    })\n  }\n\n  function handleValidateUpdate(e: MouseEvent) {\n    e.preventDefault()\n    formRef.value?.validate((errors) => {\n      if (!errors) {\n        update${context.javaBeanName}(form.value)\n      } else {\n        message.warning(\'请填入必填项！\')\n      }\n    })\n  }\n\n  function changeUnit(value: number, e: UnitTree) {\n    form.value.unitId = value\n    form.value.unitName = e.name\n  }\n\n  function changeDept(value: number, e: DeptData) {\n    form.value.deptId = value\n    form.value.deptName = e.name\n  }\n\n  const handleBack = () => {\n    router.back()\n  }\n\n  async function initForm() {\n    if (id.value) {\n      get${context.javaBeanName}(id.value)\n    }\n    unitTreeData.value = await getScopeUnitTree()\n    deptTreeData.value = await getAllDeptTree()\n  }\n  initForm()\n</script>\n<template>\n  <BaseBox>\n    <n-space vertical>\n      <n-card size=\"small\">\n        <HeaderTab nav-title=\"${table.comment}\"></HeaderTab>\n      </n-card>\n      <n-card size=\"small\" title=\"${table.comment}\" :segmented=\"{ content: true }\">\n        <div class=\"flex items-center justify-center\">\n          <n-form class=\"w-3/5\" ref=\"formRef\" :label-width=\"160\" label-placement=\"left\" :model=\"form\" :rules=\"rules\">\n            <n-grid :cols=\"24\" :x-gap=\"24\">\n              <n-form-item-gi :span=\"12\" label=\"单位名称\" path=\"unitId\">\n                <n-tree-select\n                  class=\"w-full\"\n                  filterable\n                  clearable\n                  :options=\"unitTreeData\"\n                  v-model:value=\"form.unitId\"\n                  key-field=\"id\"\n                  label-field=\"name\"\n                  children-field=\"children\"\n                  placeholder=\"请选择单位\"\n                  :on-update:value=\"changeUnit\" />\n              </n-form-item-gi>\n              <n-form-item-gi :span=\"12\" label=\"行政区划\" path=\"deptId\">\n                <n-tree-select\n                  class=\"w-full\"\n                  filterable\n                  clearable\n                  :options=\"deptTreeData\"\n                  v-model:value=\"form.deptId\"\n                  key-field=\"id\"\n                  label-field=\"name\"\n                  children-field=\"children\"\n                  placeholder=\"请选择行政区划\"\n                  :on-update:value=\"changeDept\" />\n              </n-form-item-gi>\n            </n-grid>\n            <n-grid :cols=\"24\" :x-gap=\"24\">\n#foreach($column in $columns)\n#if(!${column.isPk}&&\"${column.javaFieldName}\"!=\"unitId\"&&\"${column.javaFieldName}\"!=\"deptId\"&&\"${column.javaFieldName}\"!=\"unitName\"&&\"${column.javaFieldName}\"!=\"deptName\")\n#if(\"${column.javaType}\"==\"Date\")\n              <n-form-item-gi :span=\"12\" label=\"${column.comment}\" path=\"${column.javaFieldName}\">\n                <n-date-picker\n                class=\"w-full\"\n                v-model:formatted-value=\"form.${column.javaFieldName}\"\n                type=\"date\"\n                format=\"yyyy-MM-dd\"\n                value-format=\"yyyy-MM-dd\"\n                placeholder=\"选择${column.comment}\" />\n              </n-form-item-gi>\n              \n#else\n#if(\"${column.javaType}\"==\"int\")\n              <n-form-item-gi :span=\"12\" label=\"${column.comment}\" path=\"${column.javaFieldName}\">\n                <n-input-number\n                class=\"w-full\"\n                v-model:value=\"form.${column.javaFieldName}\"\n                placeholder=\"请输入${column.comment}\" :show-button=\"false\" :precision=\"2\" >\n                  <template #prefix></template>\n                  <template #suffix></template>\n                </n-input-number>\n              </n-form-item-gi>\n              \n#else\n              <n-form-item-gi :span=\"12\" label=\"${column.comment}\" path=\"${column.javaFieldName}\">\n                <n-input v-model:value=\"form.${column.javaFieldName}\" placeholder=\"请输入${column.comment}\" />\n              </n-form-item-gi>           \n#end\n#end\n#end\n#end\n              <!-- <n-form-item-gi :span=\"12\" label=\"项目类型\" path=\"projectType\">\n                <n-select v-model:value=\"form.projectType\" :options=\"projectTypeOpt\" placeholder=\"项目类型\" />\n              </n-form-item-gi>\n              <n-form-item-gi :span=\"12\" label=\"项目状态\" path=\"projectStatus\">\n                <n-select v-model:value=\"form.projectStatus\" :options=\"projectStatusOpt\" placeholder=\"项目状态\" />\n              </n-form-item-gi> -->\n            </n-grid>\n          </n-form>\n        </div>\n        <template #action>\n          <div class=\"flex items-center justify-center gap-4\">\n            <n-button v-if=\"id\" type=\"success\" @click=\"handleValidateUpdate\">\n              <template #icon>\n                <n-icon :component=\"ArrowUpCircle\" />\n              </template>\n              更新\n            </n-button>\n            <n-button v-else type=\"success\" @click=\"handleValidateSave\">\n              <template #icon>\n                <n-icon :component=\"Save\" />\n              </template>\n              保存\n            </n-button>\n            <n-button type=\"default\" @click=\"handleBack\">\n              <template #icon>\n                <n-icon :component=\"ArrowBackCircle\" />\n              </template>\n              返回\n            </n-button>\n          </div>\n        </template>\n      </n-card>\n    </n-space>\n  </BaseBox>\n</template>\n<style lang=\"scss\" scoped></style>\n', 0, 2, '');
COMMIT;

-- ----------------------------
-- Table structure for template_group
-- ----------------------------
DROP TABLE IF EXISTS `template_group`;
CREATE TABLE `template_group` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `group_name` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '模板组名称',
  `is_deleted` int DEFAULT '0' COMMENT '是否删除，1：已删除，0：未删除',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC COMMENT='模板组表';

-- ----------------------------
-- Records of template_group
-- ----------------------------
BEGIN;
INSERT INTO `template_group` (`id`, `group_name`, `is_deleted`) VALUES (1, 'default', 0);
INSERT INTO `template_group` (`id`, `group_name`, `is_deleted`) VALUES (2, 'Pas模板', 0);
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
